package com.chongba.schedule.inf;

import com.chongba.entity.Task;
import com.chongba.exception.ScheduleSystemException;
import com.chongba.exception.TaskNotExistException;

public interface TaskService {

    /**
     * 添加任务
     * @param task
     * @return
     * @throws ScheduleSystemException
     */
    public long addTask(Task task) throws ScheduleSystemException;

    /**
     * 取消任务
     *
     * @param taskId
     * @return
     * @throws TaskNotExistException
     */
    public boolean cancelTask(long taskId) throws TaskNotExistException;

    /**
     * 获取任务数量
     * @return
     */
    public long size(int type,int priority);

    /**
     * 拉取任务
     * @return
     * @throws TaskNotExistException
     */
    public Task poll(int type,int priority) throws TaskNotExistException;

    /**
     * 未来数据集合向消费者队列定时刷新
     */
    public void refresh();
}
